// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
    const wxContext = cloud.getWXContext()

    try {
        const result = await cloud.openapi.subscribeMessage.send({
            touser: event.openid,
            templateId: "Iu3rHMGxS9JypWGqS6dzEvBYuc1d_YWDbSuUDqr_fAI",
            page: "home",
            data: {
                character_string12: {
                    value: event.orderID
                },
                thing15: {
                    value: event.roomID
                },
                thing7: {
                    value:"请于10分钟内进入浴室，否则订单将被取消"
                }
            }
        });
        return result;
    } catch (err) {
        return err;
    }
}